package net.noday.demo.persistent.jdbcImpl.mapper;

import java.sql.ResultSet;
import java.sql.SQLException;

import net.noday.demo.domain.Article;
import net.noday.demo.domain.mapping.ArticleMapping;

import org.springframework.jdbc.core.RowMapper;

public class ArticleMapper implements RowMapper<Article> {

	@Override
	public Article mapRow(ResultSet rs, int rowNum) throws SQLException {
		Article article = new Article(rs.getLong(ArticleMapping.ID), 
				rs.getString(ArticleMapping.TITLE), 
				rs.getString(ArticleMapping.SUMMARY), 
				rs.getString(ArticleMapping.CONTENT), 
				rs.getString(ArticleMapping.CREATEDATE), 
				rs.getString(ArticleMapping.UPDATEDATE), 
				rs.getString(ArticleMapping.TAGS), 
				rs.getInt(ArticleMapping.COMMENTCOUNT), 
				rs.getString(ArticleMapping.KEYWORD), 
				rs.getShort(ArticleMapping.LEVEL));
		return article;
	}

}
